<?php
/**
 * Created by PhpStorm.
 * User: sunzexin
 * Date: 2018/1/21
 * Time: 15:58
 */

namespace App;


use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Account extends Model
{
    // 开启软删除
    use SoftDeletes;
    // 表名称
    protected $table = 'account';
    // 开启自动时间戳
    public $timestamps = true;
    // 日期都存储为时间戳
    protected $dateFormat = 'U';
    // 将钱数改变面额单位从元换算成分
    public function setBalanceAttribute($value)
    {
        $this->attributes['balance'] = $value*100;
    }
    // 将钱数改变面额单位从分换算成元
    public function getBalanceAttribute($value)
    {
        return $value/100;
    }
}